<!DOCTYPE html>
<html lang="en">
<head>
    <title>区域总监、销售总监、总经理、区域支持、销售管理，意向客户列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/dist/css/oa-app.css">

    <script src="https://file.ggxqce.com/web/vue.min.js"></script>
</head>
<style>
    [v-cloak] {
        display: none;
    }

    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        font-size: 12px;
    }

    body {
        margin: 0px;
        background: #fff;
    }

    .boxBoy {
        background: #fff;
    }

    table {
        border-spacing: 0;
        border-collapse: collapse;
        display: table;
    }

    .weather {
        text-align: center;
        font-size: 16px;
        position: absolute;
        top: 5px;
        line-height: 30px;
        float: left;
    }

    th {
        font-weight: normal;
    }

    table.text-center, table.text-center td, table.text-center th {
        text-align: center;
        font-size: 12px;
    }

    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #cbcbcd;
        height: 28px;
        /*position: relative;*/
        padding: 0 4px;
    }

    table th {
        background: #f8f8f8;
    }

    .table-bordered {
        border: 1px solid #cbcbcd;
        border-top-width: 0px !important;
    }

    .table {
        width: 100%;
        max-width: 100%;
    }

    .hidden {
        display: none;
    }

    .lineOne, .lineTwo {
        text-align: left;
    }

    .tdColor {
        background-color: #f8f8f8;
        font-weight: normal;
        color: #333 !important;
    }

    .lineOne span {
        max-height: 24px;
        line-height: 24px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        text-align: left;
    }

    .lineTwo span {
        max-height: 55px;
        line-height: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        text-align: left;
        padding: 5px;

    }

    .div-td-content-more {
        position: absolute;
        height: auto;
        z-index: 999;
        line-height: 20px;
        background-color: #d3e8fd;
        padding: 8px 6px;
        border: 1px solid #e8e8ea;
        display: none;
    }

    .div-td-content-more i {
        width: 15px;
        height: 12px;
        background: url("/dist/img/more-icon.png");
        position: absolute;
        left: 50px;
        top: -12px;
    }

    .clear {
        clear: both
    }

    .boxItem {
        width: 100%;
        margin-top: -1px;
        padding-bottom: 0;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        position: relative;
    }

    .boxItemTitle {
        color: #2c8cec;
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 6px;
        text-align: center;
    }

    .home {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
        height: 14px;
        line-height: 14px;
        text-align: center;
    }

    .dian-icon {
        background: url("/dist/img/dian.png") no-repeat;
        background-size: cover;
        width: 14px;
        height: 14px;
        display: inline-block;
    }

    .jiaobiao, .jiaobiaoNew {
        position: relative;
    }

    .jiaobiao i {
        display: block;
        width: 0;
        height: 0;
        border-width: 0px 0 12px 12px;
        border-style: solid;
        border-color: transparent transparent transparent #2a8cec;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .jiaobiaoNew i {
        display: block;
        width: 12px;
        height: 12px;
        background: url("/dist/img/newLog2.png");
        background-size: 100% 100%;
        position: absolute;
        top: 0px;
        left: 0px;
    }

    .lineImg {
        padding-top: 5px !important;
        padding-bottom: 10px !important;
    }

    .lineImg img {
        height: 45px;
        width: 45px;
        float: left;
        margin: 10px;
        object-fit: cover;
    }

    .newCustomer {
        background: url(/dist/img/new.png) no-repeat;
        background-size: cover;
        width: 20px;
        height: 20px;
        right: 0;
        top: 2px;
        position: absolute;
    }

    .wajueji {
        padding-left: 140px;
        background: url("/dist/img/wajueji.png") no-repeat;
        background-size: 120px 88px;
        height: 88px;
        line-height: 88px;
        color: red;
        font-size: 14px;
        font-weight: bold;
        margin-left: 50px;
    }

    .qipao {
        /*background: url(/dist/img/qipao.png);*/
        background-size: 100% 100%;
        height: 88px;
        /* padding: 0 20px; */
        padding-left: 20px;
        /*padding-right: 20px;*/
        color: red;
        line-height: 88px;
        float: left;
        font-size: 14px;
        font-weight: bold;
    }

    .plan1 {
        background: url("/dist/img/plan1.png") no-repeat center center;
        background-size: 100%;
    }

    .plan2 {
        background: url("/dist/img/plan2.png") no-repeat center center;
        background-size: 100%;
    }

    .plan3 {
        background: url("/dist/img/plan3.png") no-repeat center center;
        background-size: 100%;
    }

    .boxItemTitleNotice {
        color: red;
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNotice i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 22px;
        width: 22px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .boxItemTitleNoticeTime {
        color: red;
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 10px;
        text-align: center;
    }

    .boxItemTitleNoticeTime i {
        background: url("/dist/img/jg.png") no-repeat center center;
        height: 16px;
        width: 16px;
        background-size: cover;
        display: inline-block;
        margin-bottom: -3px;
        margin-left: 5px;
    }

    .search-button {
        width: 14px;
        height: 14px;
        background-image: url(/dist/img/glass.jpg);
        border: 0 none;
        cursor: pointer;
        margin-top: 0px;
    }

    input[type=button] {
        outline: none;
    }

    .oaBtn {
        background: url(/dist/img/btn-bj2.png) repeat-y !important;
        background-size: 100% 100% !important;
        color: #fff !important;
    }

    .btn-group-sm > .btn, .btn-sm {
        padding: 2px 10px;
    }

    .btn {
        border-radius: 3px;
        -webkit-box-shadow: none;
        box-shadow: none;
        border: 1px solid transparent;
    }

    .pull-right {
        float: right !important;
    }

    .blue {
        color: #39c;
    }

    .red {
        color: #e03800;
    }

    .weather img {
        height: 30px;
        width: 30px;
        float: left;
    }

    .btn-blue {
        border: none;
        background: #2a8ced;
        color: #fff;
        font-size: 12px;
        height: 32px;
        width: 18%;
        border-radius: 2px;
        outline: none;
    }

    .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
        color: #fff;
        text-decoration: none;

    }

    .line {
        border-bottom: 4px solid #2a8cec;
    }

    .fixTable {
        position: fixed;
        top: 0px;
        z-index: 1;
    }


    .shuText span {
        width: 24px;
        margin: 0 auto;
        line-height: 14px;

        display: inline-block;
    }

    .slide-box {
        display: -webkit-box;
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        height: 45px;
        line-height: 45px;
        background: #2a8cec;
        float: left;
        padding-left: 25px;
        width: 100%;
        position: fixed;
        top: 0;
    }

    .lefts {
        text-align: center;
        color: #2a8cec;
        background-image: url(/dist/img/tabApp.png);
        margin-left: 8px;
        margin-right: 8px;
        font-size: 16px;
        background-size: 100% 100%;
        padding: 10px 15px 15px;
    }

    .rights {
        text-align: center;
        color: #fff;
        font-size: 14px;
        /*border-bottom: 2px solid #f8f8f8;*/
        margin-left: 4px;
        margin-right: 4px;
        margin-top: 3px;
        padding-bottom: 5px;
    }

    .templateStyle {
        width: 100%;
        /*box-shadow: 2px 2px 3px #DDDDDD;*/
        /*margin-left: 10px;*/
        /*margin-right: 10px;*/
        margin-top: 55px;
    }

</style>
<body>
<section class="content" id="app" v-cloak style="padding: 0;min-height: 100vh">
    <div class="div-td-content-more"><i></i></div>

    <!--本月目标完成情况-->
    <div class="templateStyle" v-if="buyDate=='目标'">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td style="background-color: #2c8cec;color: white">本月目标及完成情况</td>
                    </tr>
                    </tbody>
                </table>
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td class="tdColor" style="width: 50px;">大区</td>
                        <td class="tdColor" style="width: 71px;">姓名</td>
                        <td class="tdColor" style="width: 113px;">考核周期</td>
                        <td class="tdColor" style="width: 45px;">目标</td>
                        <td class="tdColor" style="width: 62px;">本月内<br>意向</td>
                        <td class="tdColor" style="width: 68px;">已完成</td>
                        <td class="tdColor" style="width: 45px;">完成<br>概率</td>
                    </tr>
                    <tr v-for="(item,i) in listTarget">
                        <template v-if="item.roleName=='区域经理'">
                            <td class="lineOne" :rowspan="item.regionNamespan"
                                :class="{hidden: item.regionNamedis}"><span
                                    style="text-align: center;">{{item.regionName.replace(/大区/g,'')}}</span>
                            </td>
                            <td class="lineOne">
                                <span style="text-align: center;">{{item.userName}}</span>
                            </td>
                            <td>
                                {{Number(item.beginMonth.substring(5))}}、{{Number(item.middleMonth.substring(5))}}、{{Number(item.endMonth.substring(5))}}月
                            </td>
                            <td>{{item.saleTargetNum}}</td>
                            <td>{{item.count}}</td>
                            <td>{{item.saleFinishNum}}</td>
                            <td>{{Math.floor(item.probability)}}%</td>
                        </template>
                        <template v-else>
                            <td class="lineOne" :rowspan="item.regionNamespan"
                                :class="{hidden: item.regionNamedis}">
                                <span>{{item.regionName}}</span></td>
                            <td class="lineOne" style="background: #F8F8F8;">
                                <span style="text-align: center;">{{item.userName}}</span>
                            </td>
                            <td style="background: #F8F8F8;">
                                {{Number(item.beginMonth.substring(5))}}月
                            </td>
                            <td style="background: #F8F8F8;">{{item.saleTargetNum}}</td>
                            <td style="background: #F8F8F8;">{{item.count}}</td>
                            <td style="background: #F8F8F8;">{{item.saleFinishNum}}</td>
                            <td v-if="item.saleTargetNum<=item.saleFinishNum"
                                style="background: #F8F8F8;">100%
                            </td>
                            <td v-else style="background: #F8F8F8;">
                                {{Math.floor((item.probability)/(item.saleTargetNum-item.saleFinishNum))}}%
                            </td>
                        </template>
                    </tr>
                    <tr>
                        <td colspan="3">合计</td>
                        <td>{{daQuObj.saleTargetNum}}</td>
                        <td>{{daQuObj.count}}</td>
                        <td>{{daQuObj.saleFinishNum}}</td>
                        <td>{{Math.floor(daQuObj.probability)}}%</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <!--本年目标完成情况-->
    <div class="templateStyle" v-if="buyDate=='目标'">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td style="background-color: #2c8cec;color: white">本年目标及完成情况</td>
                    </tr>
                    </tbody>
                </table>
                <table class="table table-bordered text-center table-width">
                    <tbody>
                    <tr>
                        <td class="tdColor" style="width: 25%;">大区</td>
                        <td class="tdColor" style="width: 25%;">姓名</td>
                        <td class="tdColor" style="width: 25%;">目标</td>
                        <td class="tdColor" style="width: 25%;">已完成</td>
                    </tr>
                    <tr v-for="(item,i) in listTarget">
                        <template v-if="item.roleName=='区域经理'">
                            <td class="lineOne" :rowspan="item.regionNamespan"
                                :class="{hidden: item.regionNamedis}"><span
                                    style="text-align: center;">{{item.regionName}}</span></td>
                            <td class="lineOne">
                                <span style="text-align: center;">{{item.userName}}</span>
                            </td>
                            <td>{{item.yearTargetNum}}</td>
                            <td>{{item.yearFinishNum}}</td>
                        </template>
                        <template v-else>
                            <td class="lineOne" :rowspan="item.regionNamespan"
                                :class="{hidden: item.regionNamedis}"><span
                                    style="text-align: center;">{{item.regionName}}</span></td>
                            <td class="lineOne" style="background: #F8F8F8;">
                                <span style="text-align: center;">{{item.userName}}</span>
                            </td>
                            <td style="background: #F8F8F8;">{{item.yearTargetNum}}</td>
                            <td style="background: #F8F8F8;">{{item.yearFinishNum}}</td>
                        </template>
                    </tr>
                    <tr>
                        <td colspan="2">合计</td>
                        <td>{{daQuObj.yearTargetNum}}</td>
                        <td>{{daQuObj.yearFinishNum}}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <!--全部-->
    <div class="templateStyle" v-if="buyDate!='目标'">
        <div class="boxItem">
            <div class="boxBoy">
                <table class="table table-bordered text-center table-width">
                    <tbody>

                    </tbody>
                </table>
                <table class="table table-bordered text-center table-width "
                       style="table-layout: fixed;">
                    <tbody>
                    <tr>
                        <td class="tdColor" style="width: 12%;">大区</td>
                        <td class="tdColor" style="width: 14%;">区域<br>经理</td>
                        <td class="tdColor" style="width: 14%;">客户</td>
                        <td class="tdColor" style="width: 15%;">意向机型</td>
                        <td class="tdColor" style="width: 13%;">成交<br>时间</td>
                        <td class="tdColor" style="width: 12%;">成交<br>概率</td>
                    </tr>
                    <tr v-for="(item,i) in all">
                        <!--  <td>{{item.regionName}}</td>-->
                        <td class="shuText" :rowspan="item.regionNamespan"
                            :class="{hidden: item.regionNamedis}"><span style="text-align: center;">{{item.regionName.replace(/大区/g,'')}}</span><br/>
                            <div class="oa-name" :style="item.bigRegionManagerName?'':'height:0px'">
                                {{item.bigRegionManagerName}}
                            </div>
                        </td>
                        <td :rowspan="item.genZRspan" :class="{hidden: item.genZRdis}">
                            <div class="oa-name">{{item.genZR}}</div>
                        </td>
                        <td style="color: #2a8cec;overflow:hidden;"
                            @click="openDetail(item.customerId,0,'look')">
                            <div class="oa-name">
                                {{item.customerName.substring(0,item.customerName.length>4?4:item.customerName.length)}}
                            </div>
                        </td>
                        <td class="lineOne"><span>{{item.intentionModel}}</span></td>
                        <td><span class="lineOne">{{item.buyDate}}</span></td>
                        <td v-if="item.chance">{{item.chance}}</td>
                        <td v-else><50%</td>
                    </tr>
                    </tbody>
                </table>
                <div v-if="returnFlag" :class="!all ||all.length<=0?'table-bordered':''">
                    <div style="margin: 0 auto;color: #999999;text-align: center;padding: 32px;font-size: 16px;background: #fff;"
                         v-if="!all ||all.length<=0">
                        暂无意向客户
                    </div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>


    <div style="height: 44px;">
        <div class="slide-box">
            <div class="rights">
            <span :class="buyDate=='本月内'?'lefts':'rights'" style="height: 30px;"
                  @click="buyDate ='本月内';get_customerList_regionManager()">
               本月内
            </span>
                <span :class="buyDate=='下月内'?'lefts':'rights'" style="height: 30px;"
                      @click="buyDate ='下月内';get_customerList_regionManager()">
               下月内
            </span>
                <span :class="buyDate=='三月内'?'lefts':'rights'" style="height: 30px;"
                      @click="buyDate ='三月内';get_customerList_regionManager()">
               三月内
            </span>
                <span :class="buyDate=='半年内'?'lefts':'rights'" style="height: 30px;"
                      @click="buyDate ='半年内';get_customerList_regionManager()">
               半年内
            </span>
                <span :class="buyDate=='全部'?'lefts':'rights'" style="height: 30px;"
                      @click="buyDate ='全部';getAll()">
               全部
            </span>
            </div>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="/dist/plugins/scroll/myScroll.js"></script>
<!--框架已定义 JS-->
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>

<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            userId: getUrlParamObj().userId,
            companyId: getUrlParamObj().companyId,
            userInfo: {},
            regionId: getUrlParamObj().regionId ? getUrlParamObj().regionId : '',
            key: '',
            all: [],
            list1: [],
            list2: [],
            list3: [],
            list4: [],
            listLost: [],
            listDone: [],
            listTarget: [],
            daQuObj: {
                "saleTargetNum": 0,
                "count": 0,
                "saleFinishNum": 0,
                "probability": 0,
                "yearTargetNum": 0,
                "yearFinishNum": 0,
            },
            buyDate: '本月内',
            beginMonth: '',
            middleMonth: '',
            endMonth: '',
            customerList: [],
            returnFlag: false,
        },
        methods: {
            //查询全部时，regionId往后台传空 ，点击 区域时regionId不为空
//            get_customerList_manager: function () {
//                var that = this;
//                var obj = {
//                    dialog: 'show'
//                }
//                prompt(JSON.stringify(obj))
//                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getIntentCustomerListForManagerByUserId, {
//                    "userId": that.userId,
//                    "companyId": that.companyId
//                }, function (data) {
//                    console.log(data.records)
//                    that.customerList = that.tablesMergeCell(data.records);
//                    //获取合计
//                    that.calculation.week = that.getCount(that.customerList, "weekNum");
//                    that.calculation.month = that.getCount(that.customerList, "monthNum");
//                    that.calculation.threeMonth = that.getCount(that.customerList, "threeNum");
//                    that.calculation.halfYear = that.getCount(that.customerList, "banNianNum");
//                    that.calculation.allCount = that.getCount(that.customerList, "allNum");
//                    var obj = {
//                        dialog: 'hidden'
//                    }
//                    prompt(JSON.stringify(obj))
//                    that.returnFlag = true;
//                });
//            },
            //打开客户列表
            openList: function (item, buyDate) {
                var that = this;
                var obj = {
                    type: 'customerList',
                    url: '/intentionManagement/intentionalListApp.html?regionId=' + item.regionId + '&buyDate=' + buyDate + '&departName=' + item.departName + '&userId=' + that.userId,
                    name: '意向客户 (' + item.createUserName + ')',
                }
                prompt(JSON.stringify(obj))
            },
            changeBuyDate: function (buyDate) {
                var a = '';
                switch (buyDate) {
                    case 'todayMonth':
                        a = '本月内'
                        break
                    case 'nextMonth':
                        a = '下月内'
                        break
                    case 'threeMonth':
                        a = '三月内'
                        break
                    case 'halfYear':
                        a = '半年内'
                        break
                }
                return a;
            },
            //合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += (arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0)

                }
                return number;
            },
            //合并单元格
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                if (field == 'regionId') {
                                    if (list[k].regionId == list[i].regionId) {
                                        list[k][field + 'span']++;
                                        list[k][field + 'dis'] = false;
                                        list[i][field + 'span'] = 1;
                                        list[i][field + 'dis'] = true;
                                    }
                                } else {
                                    list[k][field + 'span']++;
                                    list[k][field + 'dis'] = false;
                                    list[i][field + 'span'] = 1;
                                    list[i][field + 'dis'] = true;
                                }
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //本月目标、本年目标
            getTarget: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getManagerTarget, {
                    "userId": that.userId
                }, function (data) {
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                    that.listTarget = that.tablesMergeCell(data.records);
                    var dqnum = 0;
                    var dqnum1 = 0;
                    var dqnum2 = 0;
                    var dqnum3 = 0;
                    var dqnum4 = 0;
                    for (var i = 0; i < that.listTarget.length; i++) {
                        if (that.listTarget[i].roleName == '大区经理') {
                            var roleId = that.listTarget[i].regionId;
                            var num = 0;
                            var num1 = 0;
                            var num2 = 0;
                            var num3 = 0;
                            var num4 = 0;
                            for (var a = 0; a < that.listTarget.length; a++) {
                                if (that.listTarget[a].regionId == roleId) {
                                    num += that.listTarget[a].count;
                                    num1 += that.listTarget[a].saleFinishNum;
                                    num2 += Number(that.listTarget[a].probability);
                                    num3 += Number(that.listTarget[a].yearTargetNum);
                                    num4 += Number(that.listTarget[a].yearFinishNum);
                                }
                            }
                            that.listTarget[i].count = num;
                            dqnum += num;
                            that.listTarget[i].saleFinishNum = num1;
                            dqnum1 += num1;
                            that.listTarget[i].probability = num2;
                            dqnum2 += num2;
                            that.listTarget[i].yearTargetNum = num3;
                            dqnum3 += num3;
                            that.listTarget[i].yearFinishNum = num4;
                            dqnum4 += num4;
                        }
                    }
                    //最大的合计
                    that.daQuObj.saleTargetNum = that.getCount(that.listTarget, "saleTargetNum");
                    that.daQuObj.count = dqnum;
                    that.daQuObj.saleFinishNum = dqnum1;
                    that.daQuObj.probability = Math.floor(dqnum2);
                    that.daQuObj.yearTargetNum = dqnum3;
                    that.daQuObj.yearFinishNum = dqnum4;
                })
            },
            getAll: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getIntentCustomerListForManagerByUserId, {
                    "userId": that.userId,
                    "companyId": that.companyId,
                    "buyDate": '',
                    "key": that.key
                }, function (data) {
                    var obj = {
                        dialog: 'hidden'
                    }
                    for (var i = 0; i < data.list.length; i++) {
                        for (var j = 0; j < data.report.length; j++) {
                            if ((data.report[j].regionId == data.list[i].regionId)) {
                                data.list[i].bigRegionManagerName = data.report[j].bigRegionManagerName
                            }
                        }
                    }
                    prompt(JSON.stringify(obj))
                    that.all = that.tablesMergeCell(data.list);
                })
            },
            //获取七天内等
            get_customerList_regionManager: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getIntentCustomerListForManagerByUserId, {
                    "companyId": that.companyId,
                    "userId": that.userId,
                    "buyDate": that.buyDate,
                    "key": that.key
                }, function (data) {
                    console.log(data.list)
                    for (var i = 0; i < data.list.length; i++) {
                        for (var j = 0; j < data.report.length; j++) {
                            if ((data.report[j].regionId == data.list[i].regionId)) {
                                data.list[i].bigRegionManagerName = data.report[j].bigRegionManagerName
                            }
                        }
                    }
                    var list = data.list;
                    that.all = that.tablesMergeCell(list);
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                    that.returnFlag = true;
                });
            },
            //打开客户详情
            openDetail: function (customerId, isAdd, pageType) {
                var isRegion = ''
                if (this.isSelf == 1) {
                    pageType = "edit"
                    isRegion = 1
                }
                var that = this;
                var obj = {
                    type: 'goDetail',
                    url: '/intentionManagement/quYuIntentionalDetailApp.html?customerId=' + customerId + '&isAdd=' + isAdd + '&pageType=' + pageType + '&userId=' + that.userId + '&companyId=' + that.companyId + '&isRegion=' + isRegion + '&isSelf=' + that.isSelf,
                    name: '意向客户详情',
                    enableRefresh: false,
                    showTitleBar: false
                }
                prompt(JSON.stringify(obj))
            },
            fill3Empty: function (list) {
                if (list && list.length > 0 && list.length < 3) {
                    for (var i = 0; i <= 3 - list.length; i++) {
                        list.push({})
                    }
                }
            }
        },
        mounted: function () {
            var that = this;
            $.wyui.postMethod(urlConfig.system.user.getUserViewById, {id: that.userId}, function (r) {
                console.log(r)
                that.userInfo = r;
            }, true);
            /* var obj = {
                 dialog: 'show'
             }
             prompt(JSON.stringify(obj))*/
            if (that.buyDate == '目标') {
                that.getTarget();
            } else if (that.buyDate == '全部') {
                that.getAll();
            } else {
                that.get_customerList_regionManager();
            }


        }


    })
</script>
<!--<script>-->
<!--$(".fixTable").css("width",$(".fixTable").width()+"px")-->
<!--$(window).resize(function () {-->
<!--$(".fixTable").css("width",$(".fixTable").width()+"px")-->
<!--})-->
<!--</script>-->
</body>
</html>